class CommentsController < ApplicationController
 # layout 'thickbox.html.erb'
  # GET /comments
  def index
    @comments = Comment.find(:all)
    render :action => :index, :layout => 'application.html.erb'
  end

  # GET /comments/1
  def show
    @comment = Comment.find(params[:id])
  end

  # GET /comments/new
  def new
    @comment = Comment.new
  end

  # GET /comments/1/edit
  def edit
    @comment = Comment.find(params[:id])
    # render :action => :edit, :layout => 'thickbox.html.erb'
  end

  # POST /comments
  def create    
    @comment = Comment.new(params[:comment])
    if @comment.save
      flash[:notice] = 'Comment was successfully created.'
      redirect_to video_comments_path(params[:video_id]) 
    else
      render :action => "new" 
    end
  end

  # PUT /comments/1
  def update
    @comment = Comment.find(params[:id])
    if @comment.update_attributes(params[:comment])
      flash[:notice] = 'Comment was successfully updated.'
      redirect_to video_comments_path(params[:video_id])
    else
      render :action => "edit" 
    end    
  end

  # DELETE /comments/1
  def destroy
    @comment = Comment.find(params[:id])
    @comment.destroy
    redirect_to video_comments_path(params[:video_id]) 
  end
end
